﻿using Nop.Core.Domain.Logistics;
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nop.Data.Mapping.Logistics
{
    public class WarehouseMap : EntityTypeConfiguration<LogisticsWarehouse>
    {
        public WarehouseMap()
        {
            this.ToTable("LogisticsWarehouse");

            this.Property(w => w.Name).IsRequired().HasMaxLength(100);

            this.HasRequired(w => w.Address)
                .WithMany()
                .HasForeignKey(w => w.AddressId)
                .WillCascadeOnDelete(false);
            this.HasRequired(c => c.District)
                .WithMany()
                .HasForeignKey(c => c.DistrictId)
                .WillCascadeOnDelete(false);
        }
    }
}
